<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>网格布局</title>
    <style>
        .outer{
            display: grid;
            border: 4px orange solid;
            grid-gap: 10px;

            /*
                可以为网格线命名
            */

            grid-template-columns: 200px 200px 200px 200px;
            grid-template-rows: 100px 200px 200px 100px;

            /*
                grid-template-areas
                    - 可以设置命名的区域如果在容器中排布
            */
            grid-template-areas:
                "hd hd hd hd"
                "sd main main ."
                "sd main main ."
                "ft ft ft ft"
            ;
        }

        .outer div{
            border: 4px red solid;
        }

        .box1{
            /*grid-column: 1/-1;*/
            grid-area: hd;
        }

        .box2{
            grid-area: sd;
        }

        .box3{
            grid-area: main;
        }

        .box4{
            grid-area: ft;
        }
    </style>
</head>
<body>

<div class="outer">
    <div class="box1">头部</div>
    <div class="box2">侧边栏</div>
    <div class="box3">主要内容</div>
    <div class="box4">底部</div>

</div>

</body>
</html>